package org.wenhua.yuan.and.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

public abstract class IBaseFragment extends Fragment {
    protected View rootLayout;

    @LayoutRes
    public abstract int getLayoutRes();

    public boolean isNotAlive () {
        return getActivity() == null || isDetached() || isRemoving();
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return rootLayout = inflater.inflate(getLayoutRes(), container, false);
    }
}
